<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>首页</title>
		<link rel="stylesheet" type="text/css" href="css/base.css"/>
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
		<link rel="stylesheet" type="text/css" href="css/message.css"/>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
		
		<!--[if lt IE 9]>
			<script src=" ../js/html5shiv.js"></script>
		<![endif]-->
		<style>
			#consult{

			}
		</style>
	</head>

	<body>
		
		<div class="header_bg">
			<header>
				<a class="logo" href="#">
					<img th:src="@{../images/jdym.png}" style="width:140px;height: 75px"/>
				</a>

				<ul id="nav">
					<li><a href="/jump?pg=index ">首页</a><span class="ul-img"></span></li>
					<li><a href="/jump?pg=borrow_home_page ">我要借出</a><span></span></li>
					<li><a href="/jump?pg=account_fund_management ">我要借入</a><span></span></li>
					<li><a href="/jump?pg=personal_center ">我的账户</a><span></span></li>
					<li><a href="/jump?pg=borrow_calculator">贷款计算器</a><span></span></li>
					<li><a href="/jump?pg=help_center ">帮助</a><span></span></li>
					<li><a href="/jump?pg=news ">社区</a><span></span></li>
					<li><a href="/jump?pg=authentication ">本金保障</a><span></span></li>
				</ul>

<!--				<div id="unentry_status">-->
<!--					<a href="/firm/insert" id="header_entry">登录</a>-->
<!--					<a href="/jump?pg=register " id="header_register">免费注册</a>-->
<!--				</div>-->

				<ul id="person_message" style="display: block;margin-top: -55px;margin-left: 900px;float: left;width: 200px;">
					<li><a href="/jump?pg=personal_center "><span></span></a></li>
					<li><a href="/jump?pg=personal_center " th:text="${session.currentuser.firmName}"></a></li>
					<li><a href="/jump?pg=message "><span></span></a></li>
					<li><a href="/jump?pg=#"><span></span></a></li>
					<li><a id="leave" href="/firm/removeFirm">退出</a></li>

					<span id="person_message_num">22</span>

					<span id="message_setting1"></span>
					<ul id="message_setting2">
						<li>资料设置</li>
						<li>安全中心</li>
						<li>头像设置</li>
						<li><a href="/firm/update_pwd"> 修改密码</a></li>
						<li>选项名称</li>
					</ul>

				</ul>
			</header>

			<div class="lend_out_bg">
				<div class="lend_out">
					<a href="/jump?pg=borrow_details ">发布借款</a>
					<a href="/jump?pg=borrow_interest ">利息计算器</a>
					<a href="/jump?pg=borrow_credit_rating ">个人信用借出等级</a>
					<a href="/jump?pg=lend_list_details ">借出列表详情</a>
				</div>
			</div>

			<div class="borrow_in_bg">
					<div class="borrow_in">
						<a href="/jump?pg=borrow_details ">查找借款</a>
						<a href="/jump?pg=borrow_interest ">利息计算器</a>
						<a href="/jump?pg=borrow_credit_rating ">个人信用借入等级</a>
						<a href="/jump?pg=borrow_repayment_treatment ">还款</a>
						<a href="/jump?pg=lend_list_details ">借入列表详情</a>
						<a href="/jump?pg=lend_list ">查找放款</a>
					</div>
				</div>
			
		</div>
		
		<div class="banner">
			<ul id="banner_pic">
				<li><a href="/jump?pg=#"><img src="images/banner1.jpg"/></a></li>
				<li><a href="/jump?pg=#"><img src="images/entry_pic.jpg"/></a></li>
				<li><a href="/jump?pg=#"><img src="images/banner1.jpg"/></a></li>
			</ul>
				
			<ul id="point">
				<li class="in"></li>
				<li></li>
				<li></li>
			</ul>
		</div>
		
		<div class="main">
			<div class="main_title">
				<p class="index-MainTitle-p1">我需要钱</p>
				<input type="button" name="btn1" id="btn1" value="我要借入" />
				<p class="index-MainTitle-p2">我有闲钱</p>
				<input type="button" name="btn2" id="btn2" value="我要借出" />
			</div>
			<div class="main_list">
				<div class="main_list_title">
					热门贷款
					<a href="/jump?pg=account_fund_management "></a>
				</div>

				<div class="container-fluid">
					<div class="row">
					<span id="popular"></span>



					</div>
				</div>


			</div>
<!--			在线咨询-->
			<div id="consult">
			<div class="main_news">
				<div class="main_news_title">
					<strong>最新公告</strong>
					<a href="/jump?pg=news ">更多</a>
				</div>
				
				<div class="main_news_content1">
					<a href="/jump?pg=#">首次获贷客户即享3天无理由退息</a>
					<a href="/jump?pg=#">纯信用贷款，除利息无任何费用哦亲</a>
					<a href="/jump?pg=#">万事俱备只欠东风，赶紧摸资金吧！</a>
					<a href="/jump?pg=#">9月20日小企业调研获奖名单公布…</a>
					<a href="/jump?pg=#">贷款给企业“早点”加能量，诚邀合作</a>
					<a href="/jump?pg=#">首次获贷客户即享3天无理由退息</a>
					<h4>TA投标了</h4>
					<div class="main_news_rent">
						<p>借出金额 <span id="main_news_rent_money">&yen;5000</span>个人家装及消费用</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<div class="main_news_rent">
						<p>借出金额 <span id="main_news_rent_money">&yen;5000</span>个人家装及消费用</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<div class="main_news_rent">
						<p>借出金额 <span id="main_news_rent_money">&yen;5000</span>个人家装及消费用</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<div class="main_news_rent main_news_rent2">
						<p>借出金额 <span id="main_news_rent_money">&yen;5000</span>个人家装及消费用</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<h4>TA发布了</h4>
					<div class="main_news_rent main_news_rent3">
						<p>发布了借款金额 <span id="main_news_rent_money">&yen;8800</span>生意资金周转</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<div class="main_news_rent main_news_rent3">
						<p>发布了借款金额 <span id="main_news_rent_money">&yen;8800</span>生意资金周转</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<div class="main_news_rent main_news_rent3">
						<p>发布了借款金额 <span id="main_news_rent_money">&yen;8800</span>生意资金周转</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
					<div class="main_news_rent main_news_rent2 main_news_rent3">
						<p>发布了借款金额 <span id="main_news_rent_money">&yen;8800</span>生意资金周转</p>
						<p><time>1</time>分钟前&nbsp;niczheng</p>
					</div>
					
				</div>
			</div>
			
			<div class="main_story">
				<div class="main_story_title">
					<strong>成功故事</strong>
					<a href="/jump?pg=news ">更多</a>
				</div>
				
				<div class="main_story_p1">
					<div class="story_pic"></div>
					<h5>借贷生财我的经验谈</h5>
					<p>为会员企业提供的融资贷款服务它主要满足会员企业在供的融资贷款服务员企业在生生产…</p>
				</div>
				
				<div class="main_story_p1">
					<div class="story_pic"></div>
					<h5>借贷生财我的经验谈</h5>
					<p>为会员企业提供的融资贷款服务它主要满足会员企业在供的融资贷款服务员企业在生生产…</p>
				</div>
				
				<div class="main_story_p1">
					<div class="story_pic"></div>
					<h5>借贷生财我的经验谈</h5>
					<p>为会员企业提供的融资贷款服务它主要满足会员企业在供的融资贷款服务员企业在生生产…</p>
				</div>
				
				
			</div>
			<div class="main_media">
				<div class="main_media_title">
					<strong>媒体报告</strong>
					<a href="/jump?pg=news ">更多</a>
				</div>
				
				<div class="main_media_p1">
					<div class="media_pic"></div>
					<h5>中央台财经频道</h5>
					<p>为会员企业提供的融资贷款服务它主要满足会员企业在供的融资贷款服务员企业在生生产…</p>
				</div>
				
				<div class="main_media_p1">
					<div class="media_pic"></div>
					<h5>中央台财经频道</h5>
					<p>为会员企业提供的融资贷款服务它主要满足会员企业在供的融资贷款服务员企业在生生产…</p>
				</div>
			</div>

				<div style="display: block;margin-bottom: 162px;margin-left: 680px;position: fixed;z-index: 9999;left: 300px;top: 100px;background: white;">

					<div class="company-adviser clearfix" style="width: 300px;border: 1px solid #ccc;padding: 14px;border-radius: 2px;float: left;min-height: 162px;height:162px;">
						<div class="adviser-photo" style="width: 84px;float: left;margin-right: 25px;">
							<img src="//res.rongzi.com/Main/newMain/images/userInfo/xindaiPhoto.png" title="张经理" style="margin-left: 8px;">
						</div>
						<div class="adviser-infor" style="padding-left: 22px;" >
							<p class="infor-name" style="height: 38px;line-height: 38px;">
								<span class="job"><i></i>专业顾问</span></p>
							<p class="infor-tel" style="height: 30px;line-height: 24px;color: #ff6e36;font-size: 18px;">
								400-658-9966
							</p>
							<p class="infor-concat clearfix">
								<span class="online f-fl curPointer" onclick="startMeqia()" style="width: 140px;text-align: center;height: 28px;line-height: 26px;border: 1px solid #999;border-radius: 2px;float: left;cursor: pointer;">在线咨询</span>
								<span class="wechat f-fl"></span>
							</p>
						</div>
					</div>
				</div>

			</div>
		</div>

		<div class="clear"></div>
		
		<div class="footer_bg">
			<footer>
				<ul>      
					<li><a href="/jump?pg=#">常见问题</a>|</li>
					<li><a href="/jump?pg=#">媒体报道</a>|</li>
					<li><a href="/jump?pg=#">联系我们 </a>|</li>
					<li><a href="/jump?pg=#">加入我们 </a>|</li>
					<li><a href="/jump?pg=#">隐私保护</a></li>
				</ul>
				
				<p>Copyright©2013 daikuan All Rights Reserved   建智领航公司 版权所有</p>
			</footer>
		</div>


		<!--		留言模态框-->
		<!-- 模态框（Modal） -->

		<div class="modal fade" id="Modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="exampleModalLabel">在线咨询</h5>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
						<input id="uuid" value="1" placeholder="管理员id" type="hidden"><br/>
						用户名<input type="text" id="name" value="腾讯" placeholder="用户名" style="border: none">
<!--						<button id="login" type="button" onclick="login()" value="">登陆</button>-->
						<br/><br/>
						<div id="info">

						</div>
						<br/><br/>
<!--						<input id="data">-->
						<input type="email" class="form-control" id="data" placeholder="输入内容">
<!--						<button type="button" onclick='SendData();'>发送消息</button>-->
						<button type="button" class="btn btn-default btn-sm" onclick='SendData();'>发送消息</button>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
<!--						<button type="button" class="btn btn-primary" onclick="sendMsg()">发送</button>-->
					</div>
				</div>
			</div>
		</div>


		<script src="../js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../js/Function.js" ></script>
		<script type="text/javascript" src="/js/bootstrap.min.js"></script>
		<script>
			$(function(){
				var c_start=document.cookie.indexOf('username' + "=");

				$.ajax({
					url:'/getAllPopularLoan',
					type:'get',
					success(result){
						var str="";
					console.log(result.data.popularLoans)

						$.each(result.data.popularLoans,function (index,obj) {
							str+="<div class='col-md-3'>" +
									"<a href='/Ploan?plId="+obj.plId+"'><div class='panel panel-default'>" +
									"<div class='panel-body'>"+
									"<img style='border-radius:50%;margin-botton: 27px;margin-left:30px;vertical-align: top;width: 48px;height: 48px;' src='"+obj.cobankImg+
									"'/><br><strong style='font-size: 14px; font-family: MicrosoftYaHei-Bold; color: #333; margin: 16px 26px 10px; width: 105px; overflow: hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis; white-space: nowrap; display: block;'>"+obj.cobankName+"</strong><p style='font-size:11px;margin: 0 11px 10px;'>"+obj.description+"</p></div></div></a></div>"

						})
						$("#popular").html(str)
					}
				})

			})
			//模态框
			var uuid;
			var user;
			function startMeqia(ths) {
				// document.getElementById("name").value(window.localStorage.getItem("firmName"));
				$("#name").val(window.localStorage.getItem("firmName"))
				uuid = document.getElementById("uuid").value;
				user = document.getElementById("name").value;
				$('#Modal').modal('show');
				login();
			}

			//登录
			var ws;
			var fN=window.localStorage.getItem("firmName")
			var innerHTML=''
			function login() {

				if (!ws) {


					try {
						ws = new WebSocket("ws://127.0.0.1:8010/websocket/" + user+"/"+uuid);//连接服务器
						ws.onopen = function (event) {
							console.log("已经与服务器建立了连接...");
							alert("登陆成功，可以开始聊天了")
						};
						ws.onmessage = function (event) {
							console.log("接收到服务器发送的数据..." + event.data);
							// document.getElementById("info").innerHTML += event.data + "<br>";
							innerHTML=event.data;
							//if(innerHTML.indexOf(fN)){
							//	document.getElementById("info").innerHTML+="<div style='text-align: right;width:100%;'>"+innerHTML+"</div>";
							//}else{
								document.getElementById("info").innerHTML+="<div style='text-align: left;width:100%;'>"+"张三："+innerHTML+"</div>";
						//	}
						};
						ws.onclose = function (event) {
							console.log("已经与服务器断开连接...");
						};
						ws.onerror = function (event) {
							console.log("WebSocket异常！");
						};
					} catch (ex) {
						alert(ex.message);
					}
					// document.getElementById("login").innerHTML = "退出";
				} else {
					ws.close();
					ws = null;
				}
			}

			function SendData() {
				var data = document.getElementById("data").value;
				try {
					ws.send(data);
				//	if(data.indexOf(fN)){
						document.getElementById("info").innerHTML+="<div style='text-align: right;width:100%;'>"+fN+":"+data+"</div>";
				//	}else{
						//document.getElementById("info").innerHTML+="<div style='text-align: left;width:100%;'>"+data+"</div>";
				//	}
				} catch (ex) {
					alert(ex.message);
				}
			};
		</script>
	</body>
</html>
